﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Remoting.Contexts; //上下文特性
using System.Runtime.Remoting.Messaging; //上下文消息接受
namespace Guoc.DAL.AOPFilter
{
    /// <summary>
    /// 日志特性
    /// </summary>
     [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false)]
    public class LogAttribute : ContextAttribute, IContributeObjectSink
    {
         public LogAttribute() : base("Log") { }


        public IMessageSink GetObjectSink(MarshalByRefObject obj, IMessageSink nextSink)
        {
            //接受消息，传递给AOPFiler, 程序将进行AOP 切面
            LogFilter aopFilter = new LogFilter(nextSink);
            return aopFilter;
        }
    }
}
